package com.antd.admin.server.strategy.data;

import com.antd.admin.api.dto.RoleDTO;
import com.antd.admin.api.entity.SysDept;
import com.antd.admin.server.service.ISysDeptService;
import com.antd.common.data.enums.DataScopeTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @description: 全部数据权限
 * @author: 冷言丶冷语
 * @create: 2020-10-27 10:42
 */
@Component("1")
public class AllDataScope implements AbstractDataScopeHandler {
    @Autowired
    private ISysDeptService deptService;
    @Override
    public List<String> getDeptIds(RoleDTO roleDto, DataScopeTypeEnum dataScopeTypeEnum) {
        return deptService.list()
                .stream()
                .map(SysDept::getDeptId).collect(Collectors.toList());
    }
}
